package demo5;

import java.lang.reflect.Array;
import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        int[] nums1 = new int[]{1,0};
        int[] nums2 = new int[]{};
        int m = 1;
        int n = 0;
        int i,j,k;
        int[] nums3 = new int[m+n];
        for ( i = 0, j = 0, k = 0; (i < m) && (j < n); k++) {
            nums3[k] = (nums1[i] < nums2[j]) ? nums1[i] : nums2[j];
            if (nums1[i] < nums2[j]) {
                i++;
            } else {
                j++;
            }
        }
        if (i == m) {
            while (j < n) {
                nums3[k++] = nums2[j++];
            }
        } else if (j == n){
            while (i < m) {
                nums3[k++] = nums1[i++];
            }
        }
        System.out.println(Arrays.toString(nums3));
    }
}
